Flattening Traits

نویسندگان

  • Oscar Nierstrasz
  • Stéphane Ducasse
  • Nathanael Schärli
چکیده

Traits are fine-grained components that can be used to compose classes, while avoiding many of the problems of multiple inheritance and mixin-based approaches. Since most implementations of traits have focused on dynamically-typed languages, the question naturally arises, how can one best introduce traits to statically-typed languages, like Java and C#? In this paper we argue that the flattening property of traits should be used as a guiding principle for any attempt to add traits to statically-typed languages. This property essentially states that, semantically, traits can be compiled away. We demonstrate how this principle applies to Featherweight-Trait Java, a conservative extension to Featherweight Java. CR

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Flattening versus direct semantics for

Inheritance in object-oriented languages allows, roughly, to obtain the same effect one would get by duplicating the methods of the parent class in the heir. However, the key advantage is that source code duplication is avoided, and the code of the parent is, instead, found on demand, through a runtime procedure called method lookup. In other words, two different semantics of inheritance can be...

متن کامل

Flattening versus direct semantics for Featherweight Jigsaw ∗

Inheritance in object-oriented languages allows, roughly, to obtain the same effect one would get by duplicating the methods of the parent class in the heir. However, the key advantage is that source code duplication is avoided, and the code of the parent is, instead, found on demand, through a runtime procedure called method lookup. In other words, two different semantics of inheritance can be...

متن کامل

Adding State and Visibility Control to Traits Using Lexical Nesting

Traits are reusable building blocks that can be explicitly composed to share methods across unrelated class hierarchies. In their original form, traits do not contain state and cannot express visibility control for methods. Two extensions, stateful traits and freezable traits, have been proposed to overcome these limitations. However, these extensions introduce complexity and have not yet been ...

متن کامل

Stateful traits and their formalization

Traits offer a fine-grained mechanism to compose classes from reusable components while avoiding problems of fragility brought by multiple inheritance and mixins. Traits as originally proposed are stateless, that is, they contain only methods, but no instance variables. State can only be accessed within stateless traits by accessors, which become required methods of the trait. Although this app...

متن کامل

Analytical Modified Model of Cold Rolling Process and Investigation of the Effect of Work Roll Flattening on the Rolling Force

Cold rolling of steel is one of the most important metal forming processes so an accurate control of its parameters during the process is necessary. In this paper, the friction coefficient has been proposed as a function of cold rolling parameters such as forward slip, forward and backward tensile stresses ,strip thickness, static deformation, resistance of strip before and after rolling ,strip...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

عنوان ژورنال:
  • Journal of Object Technology

دوره 5  شماره 

صفحات  -

تاریخ انتشار 2006